package com.fc.primary.queue;

/**
 * @program: fc-java->TestQueue
 * @description: test
 * @author: G_Y
 * @create: 2019-09-01 15:53
 * 手写队列——测试
 **/
public class TestQueue {

    public static void main(String[] args) {
        MyQueue<String> stringMyQueue = new MyQueue<>(4);
        stringMyQueue.enqueue("1");
        stringMyQueue.enqueue("2");
        stringMyQueue.enqueue("3");
        stringMyQueue.enqueue("4");
        f(stringMyQueue);

        stringMyQueue.enqueue("5");
        stringMyQueue.enqueue("6");
        stringMyQueue.enqueue("7");
        stringMyQueue.enqueue("8");
//        stringMyQueue.enqueue("9");
        f(stringMyQueue);

        stringMyQueue.enqueue("9");
        System.out.println("当前队列元素量" + stringMyQueue.size());
        System.out.println("出队元素" + stringMyQueue.dequeue());
        System.out.println("当前队列元素量" + stringMyQueue.size());


    }

    private static void f(MyQueue<String> stringMyQueue) {
        System.out.println("当前队列元素量" + stringMyQueue.size());
        System.out.println("出队元素" + stringMyQueue.dequeue());
        System.out.println("出队元素" + stringMyQueue.dequeue());
        System.out.println("出队元素" + stringMyQueue.dequeue());
        System.out.println("出队元素" + stringMyQueue.dequeue());
        System.out.println("当前队列元素量" + stringMyQueue.size());
    }
}
